<!-- 授权管理页面   12.15  wcf全文添加--------------------------- -->
<template>
	<div class="all">

		<span class="title">第三方配置</span>
		<div class="content">
			<div class="items">
				<el-tabs type="border-card" style="width: 100%;">
					<el-tab-pane label="企业微信">
						<el-form label-position="top" label-width="80px" :model="info5">
							<el-form-item label="agentId">
								<el-input placeholder="请输入agentId" :readonly="$permissions.indexOf(283)  == -1" v-model="info5.agentId">
								</el-input>
							</el-form-item>
							<el-form-item label="corpId">
								<el-input placeholder="请输入corpId" :readonly="$permissions.indexOf(283)  == -1" v-model="info5.corpId"></el-input>
							</el-form-item>
							<el-form-item label="secret">
								<el-input placeholder="请输入secret" :readonly="$permissions.indexOf(283)  == -1" v-model="info5.secret"></el-input>
							</el-form-item>
							<el-form-item label="网页地址">
								<el-input placeholder="例如: http://43.137.15.216:81" :readonly="$permissions.indexOf(283)  == -1" v-model="info5.webUrl"></el-input>
							</el-form-item>
							<el-form-item>
								<el-button type="primary" @click="subinfo5"  v-if="$permissions.indexOf(283)  != -1">提交</el-button>
							</el-form-item>
						</el-form>
					</el-tab-pane>
					<el-tab-pane label="钉钉">
						<el-form label-position="top" label-width="80px" :model="info4">
							<el-form-item label="agentId">
								<el-input placeholder="请输入agentId" :readonly="$permissions.indexOf(283)  == -1" v-model="info4.agentId">
								</el-input>
							</el-form-item>
							<el-form-item label="app-key">
								<el-input placeholder="请输入app-key" :readonly="$permissions.indexOf(283)  == -1" v-model="info4.key"></el-input>
							</el-form-item>
							<el-form-item label="app-secret">
								<el-input placeholder="请输入app-secret" :readonly="$permissions.indexOf(283)  == -1" v-model="info4.secret"></el-input>
							</el-form-item>
							<el-form-item label="corpId">
								<el-input placeholder="请输入corpId" :readonly="$permissions.indexOf(283)  == -1" v-model="info4.corpId"></el-input>
							</el-form-item>
							<el-form-item label="网页地址">
								<el-input placeholder="例如: http://43.137.15.216:81" :readonly="$permissions.indexOf(283)  == -1" v-model="info4.webUrl"></el-input>
							</el-form-item>
							<el-form-item>
								<el-button type="primary" @click="subinfo4" v-if="$permissions.indexOf(283)  != -1">提交</el-button>
							</el-form-item>
						</el-form>
					</el-tab-pane>
				</el-tabs>
			</div>
		</div>

	</div>
</template>
<script type="text/babel">


	export default {
		
		data() {
			return {
				info4: {
					agentId: '',
					key: '',
					secret: '',
					corpId: '',
					webUrl: '',
				},
				info5: {
					agentId: '',
					secret: '',
					corpId: '',
					webUrl: '',
				}
			};
		},
		components: {},

		created() {},

		mounted() {	
			// this.getset()
		},
		methods: {
			subinfo5() {
				if (this.info5.agentId.trim() == '' || this.info5.secret.trim() == '' || this.info5.corpId.trim() == '' ||
					this.info5.webUrl.trim() == '') {
					this.$Toast('请填写完整！');
					return
				}
				var that = this
				this.$http.post(this.$url + '/wecom/refresh', this.info5)
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$message(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
			that.$Toast(response.data.msg);
						// that.getinfo4()
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
			
			},
			subinfo4() {
				if (this.info4.agentId.trim() == '' || this.info4.key.trim() == '' || this.info4.secret.trim() == '' ||
					this.info4.corpId.trim() == '' || this.info4.webUrl.trim() == '') {
					// this.$message('请填写完整！');
					this.$Toast('请填写完整！');
					return
				}
				var that = this
				this.$http.post(this.$url + '/dingtalk/refresh', this.info4)
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$message(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
			
						that.$Toast(response.data.msg);
						// that.getinfo4()
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
			
			},
		getset() {
			var that = this
			this.$http.get(this.$url + '/sys/gdVersion')
				.then(function(response) {
		            console.log(response);
		           
					if (response.data.code == '1410') {
		                    that.$Toast(response.data.msg);
		                    sessionStorage.setItem('token', '')
		                    that.$router.push('/login')
						return
					}
		            that.value1=response.data.msg
					
				})
				.catch(function(error) {
					console.log(error);
					that.$Toast('网络拥堵，刷新一下');
				});
		},
			},
        }
</script>

<style lang='less' scoped>
	* {
		margin: 0px;
		padding: 0px;
		list-style: none;
		font-family: 微软雅黑 !important;
	}

	.all {
		padding: 10px 30px;
		//background-color: #F3F3F4;
	}

	.title {

		color: #000;
		display: inline-block;
		/* width: 100px; */
		height: 48px;
		line-height: 48px;
		text-align: center;
		border-radius: 5px;
		border-bottom: none;
		font-size: 24px;
	}

	.content {
		width: 100%;
		//border-top:1px solid #DDDDDD ;
	}

	.items {
		max-width: 700px;
		padding: 10px;
		background-color: #fff;
		padding-right: 5%;
	}

	.item {
		margin-top: 20px;
	}

	.items p {
		font-size: 14px;
		color: #333;

	}



	.el-input__inner:hover {
		cursor: pointer;
		background-color: #EEE !important;
		color: #7A6164;
	}

	.el-input__inner:focus {
		outline: none;
	}

	.el-button--primary {
		margin-top: 10px;
		padding: 10px 15px;
	}

	.el-input__inner {
		background-color: #EEE !important;
		color: #717170;
		font-size: 14px;
	}

	.el-input__inner:focus {
		outline: none;
	}
</style>
<style>

</style>
